var removeElements = function (head, val) {

    let dommyhead = new ListNode(0);
    dommyhead.next = head;

    let cur = dommyhead;

    while (cur.next != null) {
        if (cur.next.val === val) {
            cur.next = cur.next.next;
        } else {
            cur = cur.next;
        }

    }
    return dommyhead.next;

};